<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>中控登录</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="robots" content="noindex,nofollow" />
    <link rel="stylesheet" href="https://at.alicdn.com/t/font_1469344_zdsb0lx8h49.css">
    <style>
        html {
            width: 100%;
            height: 100%;
            box-sizing: border-box;
        }

        body {
            width: 100%;
            overflow-x: hidden;
            height: 100%;
            background: repeat-x left bottom -20px;
            background-image: url("__IMG__/bgsvg.svg");
            background-color: #f8fcfd;
            background-size: 100%;
            margin: 0;
        }

        .container {
            display: flex;
            align-items: center;
            height: 100%;
        }

        .login_box {
            width: 1031px;
            height: 720px;
            position: relative;
            box-shadow: 3px 4px 16px 0 #e3e3e3;
            background-color: #fff;
            margin: 0 auto;
            display: flex;
        }

        .input_box {
            width: 501px;
            padding: 70px;
            background: #fff;
            box-sizing: border-box;
        }

        .img_box {
            background-image: linear-gradient(180deg, #11ca8d, #237c96);
            text-align: center;
            display: flex;
            align-items: center;
            width: 530px;
        }

        .img_box img {
            width: 410px;
            margin: 0 auto;
        }

        .input_box .login_now {
            margin-top: 40px;
        }

        .input_box .title {
            margin-bottom: 12px;
        }

        .input_box .title .welcome {
            color: #1f2d3d;
            font-size: 36px;
            font-weight: 600;
            margin: 0;
        }

        .input_box .title .sub_title {
            font-size: 14px;
            color: #475669;
            font-weight: 600;
            margin-top:10px;
        }
        .input_box .u_input{
            padding-bottom: 20px;
            position: relative;
        }
        .input_box .u_input>div {
            height: 40px;
            display: flex;
            position: relative;
            align-items: center;
        }

        .input_box .u_input a {
            text-decoration: none;
            color: #5e6d83;
            font-size: 14px;
            white-space: nowrap;
            flex-shrink: 0;
        }

        .input_box .u_input b {
            height: 2px;
            position: absolute;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #D3DCE6;
            transition: all linear .3s;
        }
        .input_box .u_input .iconfont+div{
            height: 40px;
            flex:1;
        }
        .input_box .u_input input {
            height: 100%;
            outline: none;
            border: none;
            font-size: 15px;
            color: #475669;
            width:100%;
        }

        .input_box .u_input input::placeholder,
        .input_box .u_input i.iconfont {
            color: #9AA9BE;
        }

        .input_box .u_input i.iconfont {
            margin-right: 10px;
        }

        .input_box .remember {
            font-size: 14px;
            color: #475669;
        }

        .other {
            font-size: 0;
            position: relative;
        }

        .check_box {
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            -webkit-transform: translateY(-50%);
            -moz-transform: translateY(-50%);
            -ms-transform: translateY(-50%);
            -o-transform: translateY(-50%);
            border: 1px solid #D3DCE6;
            width: 16px;
            height: 16px;
            border-radius: 3px;
            box-sizing: border-box;
        }

        .other label {
            margin-left: 10px;
        }

        .input_box input[type=checkbox] {
            visibility: hidden;
            margin: 0;
            padding: 0;
        }

        .other input:checked+span {
            background-color: #037BFF;
            border-color: #037BFF;
        }

        .other input:checked+span::before {
            display: block;
            content: "\e650";
            color: #000;
            font-size: 12px;
            font-family: "iconfont" !important;
            color: #fff;
        }

        .login_btn {
            margin-top: 48px;
        }

        .login_btn a {
            display: block;
            border-radius: 3px;
            height: 40px;
            background-color: #04cb94;
            text-decoration: none;
            text-align: center;
            line-height: 40px;
            color: #fff;
            font-size: 15px;
        }

        .bg_linear {
            background-image: linear-gradient(to right, #5DAFE5, #4BD49D);
        }

        .bg_red {
            background-color: #fc6772 !important;
        }

        .u_input .warn {
            position: absolute;
            bottom:0;
            left:25px;
            font-size: 13px;
            color: #fc6772;
            display: none;
        }

        .code_input {
            margin-bottom: 10px;
        }
        @media screen and (max-width: 768px){
            body{
                background-image: none;
                text-align: center;
            }
            .login_box{
                width: 90%;
                height: 504px;
                min-height: 504px;
                padding: 40px 33px;
                box-sizing: border-box;
            }
            .input_box{
                width: 100%;
            }
            .login_box .img_box{
                display: none;
            }
            .input_box{
                padding:0;
            }
            .other{
                text-align: left;
            }
        }
    </style>
</head>

<body>
    <div class="container">
        <div class="login_box">
            <div class="input_box">
                <div class="title">
                    <h2 class="welcome"></h2>
                    <p class="sub_title">欢迎使用本系统</p>
                </div>
                <div class="login_now">
                    <form class="login-input">
                        <div class="u_input">
                            <div class="i_box">
                                <i class="iconfont iconai-user"></i>
                                <div>
                                    <input type="text" name="name" id="name" autocomplete="off" placeholder="请输入用户名或手机号" {notempty name="usermember" }value="{$usermember}" {/notempty} />
                                </div>
                                <b></b>
                            </div>
                            <span class="warn">请输入用户名或手机号</span>
                        </div>
                        <div class="u_input">
                            <div class="i_box">
                                <i class="iconfont iconmima"></i>
                                <div>
                                    <input type="password" name="password" autocomplete="off" id="password" placeholder="请输入密码">
                                </div>
                                <a href="javascript:;" class="forget">忘记密码</a>
                                <b></b>
                            </div>
                            <span class="warn">请输入密码</span>
                        </div>
                        <div class="u_input code_input">
                            <div class="i_box">
                                <i class="iconfont iconyanzhengma"></i>
                                <div>
                                    <input type="text" name="captcha" autocomplete="off" id="captchaInput" placeholder="请输入验证码">
                                </div>
                                <img src="{:captcha_src()}" alt="captcha" onclick="this.src='{:captcha_src()}?seed='+Math.random()" height="36" id="captcha" style="margin-top: 1px" />
                                <b></b>
                            </div>
                            <span class="warn">请输入验证码</span>
                        </div>
                        <div class="other">
                            <input type="checkbox" id="remember" lay-skin="primary" title="记住账号" name="remember" value="1" {notempty name="usermember" }checked="" {/notempty}>
                            <span class="check_box"></span>
                            <label for="remember" class="remember">记住账号？</label>
                            {:token('__token__', 'sha1')}
                        </div>
                        <div class="login_btn">
                            <a href="javascript:;" class="login-btn">登录</a>
                        </div>
                    </form>
                </div>
            </div>
            <div class="img_box">
                <img src="__IMG__/login.svg">
            </div>
        </div>
    </div>
    <script src="__PUBLIC__/layui/layui.js"></script>
    <script src="__PUBLIC__/jquery/jquery.min.js"></script>
    <script>

        layui.use(['layer', 'form'], function () {
            var layer = layui.layer,
                $ = layui.jquery;
            var hour = new Date().getHours();
            var welcome="";
            hour>6 && hour<=12?welcome="上午好！":
            hour>12 && hour<=18?welcome="下午好！":
            hour>18 && hour<=24?welcome="晚上好！":welcome="夜深了~";
            $(".title .welcome").html(welcome);
            
            // $(".other").click(function () {
            //     layer.msg("666");
            // })
            $(".forget").click(function () {
                layer.msg("请联系管理员重置密码");
            })
            $(".u_input input").focus(function () {
                $(this).parent().siblings("b").addClass("bg_linear");
            })
            $(".u_input input").blur(function () {
                if (!$(this).val()) {
                    $(this).parent().siblings("b").removeClass("bg_linear");
                }else{
                    $(this).parents(".i_box").siblings(".warn").hide();
                }
            })
            $(".login-btn").click(function () {
                login();
            })
            $("input").on("keyup", function (e) {
                if (e.keyCode == 13) {
                    login();
                }
            })
            function login() {
                var inputs = $(".u_input input"), result = true;
                $(inputs).each(function (idx, el) {
                    if (!$(el).val()) {
                        var tips = $(el).prev().html(), domId = $(el).attr("id");
                        $(el).parents(".i_box").siblings(".warn").slideDown("slow");
                        $(el).parent().siblings("b").addClass("bg_red");
                        result = false;
                    }
                })
                if (!result) {
                    return;
                }
                var param = $(".login-input").serialize();
                $.ajax({
                    url: "{:url('login')}",
                    data: param,
                    type: 'post',
                    success: function (res) {
                        layer.msg(res.msg, { offset: '50px', anim: 1 });
                        if (res.code == 1) {
                            setTimeout(function () {
                                location.href = res.url;
                            }, 1500);
                        } else {
                            $('#captcha').click();
                        }
                    }
                })
            }
        });
    </script>
</body>

</html>